{"ast":null,"code":"import _regeneratorRuntime from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js\";import _asyncToGenerator from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";import _classCallCheck from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/classCallCheck.js\";import _createClass from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/createClass.js\";import apiClient from\"../http\";import{addMessage as addMessagePath,updateMessage as updateMessagePath,deleteMessages as deleteMessagesPath}from\"../routes\";var MessageService=/*#__PURE__*/function(){function MessageService(){_classCallCheck(this,MessageService);}_createClass(MessageService,null,[{key:\"addMessage\",value:function(){var _addMessage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(message){return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:return _context.abrupt(\"return\",apiClient.post(addMessagePath(),message));case 1:case\"end\":return _context.stop();}}},_callee);}));function addMessage(_x){return _addMessage.apply(this,arguments);}return addMessage;}()},{key:\"updateMessage\",value:function(){var _updateMessage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(message){return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:return _context2.abrupt(\"return\",apiClient.put(updateMessagePath(),message));case 1:case\"end\":return _context2.stop();}}},_callee2);}));function updateMessage(_x2){return _updateMessage.apply(this,arguments);}return updateMessage;}()},{key:\"deleteMessages\",value:function(){var _deleteMessages=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(shortMessagesCollection){return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:return _context3.abrupt(\"return\",apiClient.delete(deleteMessagesPath(),shortMessagesCollection));case 1:case\"end\":return _context3.stop();}}},_callee3);}));function deleteMessages(_x3){return _deleteMessages.apply(this,arguments);}return deleteMessages;}()}]);return MessageService;}();export{MessageService as default};","map":{"version":3,"names":["apiClient","addMessage","addMessagePath","updateMessage","updateMessagePath","deleteMessages","deleteMessagesPath","MessageService","message","post","put","shortMessagesCollection","delete"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/src/services/MessageService.ts"],"sourcesContent":["import apiClient from \"../http\";\nimport {AxiosResponse} from 'axios';\nimport {\n    addMessage as addMessagePath,\n    updateMessage as updateMessagePath,\n    deleteMessages as deleteMessagesPath\n} from \"../routes\";\nimport {ChatsListItem} from \"../models/response/ChatsListItem\";\nimport MessageRequest from \"../models/request/MessageRequest\";\nimport UpdateMessageItem from \"../models/request/UpdateMessageItem\";\nimport {MessagesShortListRequest} from \"../models/request/MessagesShortListRequest\";\n\nexport default class MessageService {\n    public static async addMessage(message: MessageRequest): Promise<AxiosResponse<ChatsListItem>> {\n        return apiClient.post<ChatsListItem>(addMessagePath(), message);\n    }\n\n    public static async updateMessage(message: UpdateMessageItem): Promise<AxiosResponse<ChatsListItem>> {\n        return apiClient.put<ChatsListItem>(updateMessagePath(), message);\n    }\n\n    public static async deleteMessages(shortMessagesCollection: MessagesShortListRequest): Promise<AxiosResponse<MessagesShortListRequest>> {\n        // @ts-ignore\n        return apiClient.delete<MessagesShortListRequest>(deleteMessagesPath(), shortMessagesCollection);\n    }\n}"],"mappings":"skBAAA,MAAOA,UAAS,KAAM,SAAS,CAE/B,OACIC,UAAU,GAAIC,eAAc,CAC5BC,aAAa,GAAIC,kBAAiB,CAClCC,cAAc,GAAIC,mBAAkB,KACjC,WAAW,CAAC,GAMEC,eAAc,wOAC/B,iBAA+BC,OAAuB,oJAC3CR,SAAS,CAACS,IAAI,CAAgBP,cAAc,EAAE,CAAEM,OAAO,CAAC,wDAClE,+MAED,kBAAkCA,OAA0B,yJACjDR,SAAS,CAACU,GAAG,CAAgBN,iBAAiB,EAAE,CAAEI,OAAO,CAAC,0DACpE,2NAED,kBAAmCG,uBAAiD,yJAEzEX,SAAS,CAACY,MAAM,CAA2BN,kBAAkB,EAAE,CAAEK,uBAAuB,CAAC,0DACnG,4IAZgBJ,cAAc"},"metadata":{},"sourceType":"module"}